package com.yc;


import java.net.InetAddress;
import java.net.UnknownHostException;

public class Test1_InetAddress {
    public static void main(String[] args) throws UnknownHostException {
        InetAddress ia1 = InetAddress.getLocalHost();
        System.out.println(ia1);
        InetAddress[] ia2 = InetAddress.getAllByName("www.baidu.com");
        if (ia2!=null) {
            for (InetAddress ia: ia2) {
                System.out.println(ia);
            }
        }
    }
}
